/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package xenon3d.scene;

import javax.media.opengl.GL2;

/**
 * An enumeration of all Xenon3D vertex formats.
 *
 * @author Volker Everts
 * @version 0.1 - 13.08.2008: Created
 * @version 0.2 - 04.09.2011: Adapted
 */
public enum VertexFormat {

    /** Vertex format providing coordinates only. */
    Vertex3D (GL2.GL_V3F, 3, false),

    /** Vertex format providing coordinates and vertex colors. */
    VertexColor3 (GL2.GL_C3F_V3F, 6, false),

    /** Vertex format providing coordinates and vertex normals. */
    VertexNormal (GL2.GL_N3F_V3F, 6, false),

    /** Vertex format providing coordinates and 2D texture coords. */
    VertexTex (GL2.GL_T2F_V3F, 5, true),

    /** Vertex format providing coordinates, vertex colors and 2D texture coords. */
    VertexColor3Tex (GL2.GL_T2F_C3F_V3F, 8, true),

    /** Vertex format providing coordinates, vertex normals and 2D texture coords. */
    VertexNormalTex (GL2.GL_T2F_N3F_V3F, 8, true),

    /** Vertex format providing coordinates, vertex normals and vertex colors including alpha. */
    VertexNormalColor4 (GL2.GL_C4F_N3F_V3F, 10, false),

    /** Vertex format providing coordinates, vertex normals, vertex colors including alpha and 2D texture coords. */
    VertexNormalColor4Tex (GL2.GL_T2F_C4F_N3F_V3F, 12, true);

    /** The OpenGL constant for that specific vertex format. */
    private int value;

    /** The size of one vertex record in floats. */
    private int size;

    /** A flag indicating whether a specific vertex format includes texture coords or not. */
    private boolean tex;

    /**
     * Creates a VertexFormat enumeration element.
     * @param value the OpenGL constant for that specific vertex format
     * @param size the size of one vertex record in floats
     * @param tex true, if the vertex format includes texture coords
     */
    VertexFormat(int value, int size, boolean tex) {
        this.value = value;
        this.size = size;
        this.tex = tex;
    }

    /**
     * Gets the OpenGL constant for that specific vertex format.
     * @return the format constant
     */
    public int value() {
        return value;
    }

    /**
     * Gets the size of one vertex record in floats.
     * @return the vertex size
     */
    public int size() {
        return size;
    }

    /**
     * Returns a flag indicating whether a specific vertex format includes
     * texture coords or not.
     * @return true, if the vertex format includes texture coords
     */
    public boolean hasTexture() {
        return tex;
    }

} // end enum VertexFormat